/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ec.socialfun.datamanager;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.jboss.logging.Logger;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;

/**
 *
 * @author jorge
 */
@ManagedBean
@SessionScoped
public class TarjetaVirtualDataManager {

    private static final Logger LOG = Logger.getLogger(TarjetaVirtualDataManager.class.getName());
    private StreamedContent qrCode;
    private File qrCodeFile;
    private boolean mostarMensaje = true;

    public boolean isMostarMensaje() {
        return mostarMensaje;
    }

    public void setMostarMensaje(boolean mostarMensaje) {
        this.mostarMensaje = mostarMensaje;
    }
    
    
    public File getQrCodeFile() {
        return qrCodeFile;
    }

    public void setQrCodeFile(File qrCodeFile) {
        this.qrCodeFile = qrCodeFile;
    }

    /**
     * Creates a new instance of TarjetaVirtualDataManager
     */
    public TarjetaVirtualDataManager() {
    }

    public StreamedContent getQrCode() throws FileNotFoundException {
        if (this.getQrCodeFile() == null) {
            return null;
        }
        return new DefaultStreamedContent(new FileInputStream(this.getQrCodeFile()));
    }

    public void setQrCode(StreamedContent qrCode) {
        this.qrCode = qrCode;
    }
}
